<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
        }
        
        .head-box {
            background-color: #45b959;
            border-bottom: 1px solid gainsboro;
            line-height: 50px;
            /* text-align: center; */
            font-size: 20px;
            position: fixed;
            top: 0;
            width: 100%;
        }
        
        .head-box input {
            width: 300px;
            border: none;
            line-height: 35px;
            padding-left: 35px;
            margin-left: 10px;
            border-radius: 5px;
        }
        
        .img-box {
            width: 25px;
            height: 25px;
            /* background-color: pink; */
            position: absolute;
            top: 8px;
        }
        
        .img-box img {
            width: 100%;
        }
        
        .img1 {
            left: 15px;
        }
        
        .img2 {
            right: 20px;
        }
        
        .img3 {
            right: 70px;
            top: 5px;
            width: 20px;
        }
        
        a {
            text-decoration: none;
            color: gray;
        }
        
        .foot-box {
            background-color: #f7f7f7;
            border-top: 1px solid gainsboro;
            position: fixed;
            bottom: 0;
            width: 100%;
            padding: 5px 0;
        }
        
        .foot-box li {
            float: left;
            width: 20%;
            text-align: center;
            font-size: 14px;
        }
        
        .foot-box img {
            width: 35px;
        }
    </style>
</head>

<body>
    <div id="app">
        <my-head></my-head>
        <my-footer></my-footer>
    </div>

    <template id="head">
        <header class="head-box">
            <input type="text" placeholder="影视 图书 唱片 小组等">
            <div class="img-box img1">
                <img src="images/ic_search_gray.png" alt="">
            </div>
            <div class="img-box img2">
                <img src="images/ic_chat_white.png" alt="">
            </div>
            <div class="img-box img3">
                <img src="images/ic_scan_gray.png" alt="">
            </div>
        </header>
    </template>
    <template id="foot">
        <footer class="foot-box">
            <ul>
                <!-- 动态传值 -->
                <item v-for="(item,index) in arr" :txt='item.title' :imgsrc='item.src'></item>

            </ul>
        </footer>
    </template>
    <template id="ft">
        <li>
            <a href="#">
                <div><img :src="imgsrc" alt=""></div>
                {{txt}}
            </a>
        </li>
    </template>
</body>
<script src="js/vue.js"></script>
<script>
    let vm = new Vue({
        el: "#app",
        components: {
            myHead: {
                template: "#head",
            },
            myFooter: {
                data() {
                    return {
                        arr: [{
                            title: "首页",
                            src: "images/1.png"
                        }, {
                            title: "书影音",
                            src: "images/2.png"
                        }, {
                            title: "广播",
                            src: "images/3.png"
                        }, {
                            title: "小组",
                            src: "images/4.png"
                        }, {
                            title: "我的",
                            src: "images/5.png"
                        }, ],
                    }
                },
                template: "#foot",
                components: {
                    item: {
                        props: ['txt', 'imgsrc'],
                        template: '#ft'
                    }
                }
            }
        }
    })
</script>

</html>